<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript">
		/*console.log(Math.random()*10);*/
		//console.log(Math.round(8.8));
	/*console.log(Math.min(1,2,3,4,11,22,10));
	console.log(Math.max(1,2,3,4,11,22,10));*/
	// var result=Math.random()*5;
    // var result1=Math.floor(result);

    // var arr2=[7,8,9,7,9];
	// console.log(arr[result1]);
    

	var arr=[{
		"firstname":"王",
		"lastname":["安石","维","3","4","5"],
		
        toString:function(){
			var result=Math.random()*5;
            var result1=Math.floor(result);
			
				return arr[0].firstname+arr[0].lastname[result1]
			}
	},{
		"firstname":"李",
		"lastname":["白","魁","世民","清照","商隐"],
		toString:function(){
			var result=Math.random()*5;
            var result1=Math.floor(result);
			
				return arr[1].firstname+arr[1].lastname[result1]
			}
	},{
		"firstname":"张",
		"lastname":["飞","若虚","3","4","5"]
	},{
		"firstname":"欧阳",
		"lastname":["修","峰","3","4","5"]
	}];
	var result=prompt("请输入您的今生姓名：");
    var x=result.slice(0,1);
	switch(x){
		case x="王":
		       console.log(arr[0].toString());
		       break;         
        case firstname="李":
		console.log(arr[1].toString());
		break;
		case firstname="张":
		case firstname="欧阳": 
		default:
               console.log("没有找到你的前生")
	}
	// console.log(result);
	// console.log(  result.slice(0,1))



	</script>
</head>
<body>
	
</body>
</html>